/* 
 * File:   main.cpp
 * Author: Lance
 *
 * Created on September 13, 2012, 10:17 PM
 */

#include <cstdlib>
#include <iostream>
#include "Downloader.h"
#include "Log.h"

using namespace std;
/*
 * 
 */
int main(int argc, char** argv) {
	//validate input pass it to Downloader
	int threads = 1;
	
	int option;
	
	while((option = getopt(argc, argv, "n:d:")) != -1)
	{
		de = false;
		switch(option)
		{
			case 'n':
				threads = atoi(optarg);
				break;
			case 'd':
				de = true;
				break;
			default:
				cout << '-' << optopt <<" is an invalid option" << endl;
				cout << "USAGE: download [-n threads] <URL>" << endl;
				exit(EXIT_FAILURE);
		}
	}

	string url = argv[argc-1];
	
	Downloader accelerator(url, threads);
	
	return 0;
}

